<?php
session_start();

require_once '../include/config.lib.php';
require_once '../include/database.lib.php';

if(isset($_SESSION["accountNo"]))
{
	ConnectToDB();
	$selectid = DBExecute("SELECT id FROM person WHERE username = ?",$_SESSION["accountNo"]);
	$id = $selectid->fetchAssocRow();//find the person's id to redirect to the person's own page
	$url = "../person_view.php?id=".$id["ID"];
	echo "<HTML><META http-equiv=\"refresh\" content=\"0; url='".$url."'\"></HTML>";//redirect to the person's profile page
}
else 
{
	$_SESSION["errmsg"] = "Please log in first.";
	echo "<HTML><META http-equiv=\"refresh\" content=\"0; url=../login.php\"></HTML>";//redirect to the login page
}

?>